home *** CD-ROM | disk | FTP | other *** search
/ 64'er 1988 February / 64er_Magazin_88-02_1988_Markt__Technik_de_Side_A.d64 / x^3-julia-mengen (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  2KB  |  74 lines

  1. 10 rem ****************************
  2. 20 rem *   julia-mengen (x^3)     *
  3. 30 rem * 1987 by stefan vilsmeier *
  4. 40 rem ****************************
  5. 50 :
  6. 60 if a=0 then a=1:load "fractal.obj",8,1
  7. 70 open 1,8,15,"u9":close 1: rem diese zeile kann bei problemen mit dem
  8. 80 rem floppyspeeder weggelassen werden!
  9. 90 poke53280,0:poke53281,0
  10. 100 :
  11. 110 :
  12. 120 rem ******* eingaben ***********
  13. 130 :
  14. 140 input"[147]anfang realteil        ";x1
  15. 150 input"ende realteil          ";x2
  16. 160 input"anfang imaginaerteil   ";y1
  17. 170 input"ende imaginaerteil     ";y2
  18. 180 input"anzahl der iterationen ";z
  19. 190 :
  20. 200 :
  21. 210 rem ******* konstanten *********
  22. 220 :
  23. 230 ep=.0025:w=2/3
  24. 240 xa=1:ya=0:xb=-.5:yb=.8660254:xc=-.5:yc=-.8660254
  25. 250 sys 50176,14,0:sys 50179,1:sys 50194:rem grafik ein
  26. 260 :
  27. 270 :
  28. 280 rem ****************************
  29. 290 rem *       hauptschleife      *
  30. 300 rem ****************************
  31. 310 :
  32. 320 dx=(x2-x1)/320:dy=(y1-y2)/200
  33. 330 for yy=0 to 199
  34. 340 :for xx=0 to 319
  35. 350 : f=0:zz=0:za=0
  36. 360 : x  = x1 + xx*dx:y = y2 + yy*dy
  37. 370 : xq = x*x:yq = y*y
  38. 380 : n  = xq + yq:if n=0 then n=1e-5
  39. 390 : gosub 530:rem ******** check
  40. 400 : if zz<z and f=0 goto 390
  41. 410 : if f=4 then sys 50182,xx,yy,1
  42. 420 :next xx
  43. 430 next yy
  44. 440 get a$:if a$="" goto 440
  45. 450 sys 50179,0:if a$="s" then gosub 700: rem 'grafik speichern'
  46. 460 goto 110: rem neustart
  47. 470 :
  48. 480 :
  49. 490 rem ****************************
  50. 500 rem *         'check'          *
  51. 510 rem ****************************
  52. 520 :
  53. 530 za = -2*((x-xa)*(x-xa)+(y-ya)*(y-ya)<=ep)
  54. 540 za = za-3*((x-xb)*(x-xb)+(y-yb)*(y-yb)<=ep)
  55. 550 za = za-4*((x-xc)*(x-xc)+(y-yc)*(y-yc)<=ep)
  56. 560 :
  57. 570 zz = zz+1
  58. 580 n  = n*n*3:xy  = x*y
  59. 590 x  = w*x+(xq-yq)/n:y  = w*y-(xy+xy)/n
  60. 600 xq = x*x:yq = y*y
  61. 610 n  = xq + yq
  62. 620 f  = -(n<1e-18)
  63. 630 if f=0 then f=-(n>1e+18)
  64. 640 if f=0 then f=za
  65. 650 return
  66. 660 :
  67. 670 rem ***************************
  68. 680 rem *   'grafik speichern'    *
  69. 690 rem ***************************
  70. 700 :
  71. 710 input "grafik-name ";n$
  72. 720 open 2,8,2,"pi."+n$+",p,w":sys 50191:close 2
  73. 730 return
  74.